package com.sy.controller;

import com.sy.entity.ClassMsg;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class ClassController extends BaseController{

    @RequestMapping(value = "/classMsgs",method = RequestMethod.GET,params = {"type=ByTeacher"})
    public List<ClassMsg> getClassListForTeacher(){
        //获取当前老师的id
        Integer teacherId = getSessionUserId();
        List<ClassMsg> classList = teacherService.getClassListByTeacherId(teacherId);
        return classList;
    }
    @RequestMapping(value = "class/{id}",method = RequestMethod.GET)
    public ClassMsg getClassMsg(@PathVariable("id")Integer classId){
        return teacherService.getClassMsgById(classId);
    }
}
